#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
typedef double db;
inline LL read()
{
	LL x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+ch-'0'; ch=getchar(); }
	return x*f;
}
const int MAXN=2e3+10;
int n,A,B;
LL pre[MAXN];
inline bool chk(LL sum,LL ans,int bit)
{
	return ((sum>>bit)&1)==0&&((sum>>(bit+1))|ans)==ans;
}
LL solve1()
{
	bool f[MAXN][MAXN];
	LL ret=0;
	for(int bit=(int)log2(pre[n]);bit>=0;--bit)
	{
		memset(f[0],0,sizeof(f[0]));
		f[0][0]=true;
		for(int i=1;i<=n;++i)
			for(int j=1;j<=min(i,B);++j)
			{
				f[i][j]=false;
				for(int k=0;k<i&&!f[i][j];++k)
					if(f[k][j-1]&&chk(pre[i]-pre[k],ret,bit))f[i][j]=true;
			}
		int flag=false;
		for(int i=A;i<=B&&!flag;++i)flag|=f[n][i];
		ret=(ret<<1)|(!flag);
	}
	return ret;
}
LL solve2()
{
	int g[MAXN];
	LL ret=0;
	for(int bit=(int)log2(pre[n]);bit>=0;--bit)
	{
		g[0]=0;
		for(int i=1;i<=n;++i)
		{
			g[i]=B+1;
			for(int j=0;j<i;++j)
				if(g[j]+1<g[i]&&chk(pre[i]-pre[j],ret,bit))g[i]=g[j]+1;
		}
		ret=(ret<<1)|(!(g[n]<=B));
	}
	return ret;
}
int main()
{
	n=read();A=read();B=read();
	for(int i=1;i<=n;++i)pre[i]=pre[i-1]+read();
	printf("%lld\n",A>1?solve1():solve2());
	return 0;
}
